$(function() {
	var $modal = $('#my-modal-loading');
	var query_id = localStorage.getItem("query_id");
	console.log("store_id:" + query_id);
	var urlPath = "http://yx.fxtourong.com/V1/Circle/setCirclePermissions" + "?store_id=" + query_id;
	$("#saveIt").click(function(){
		var index = 1;
		var perissionStr = $("input[name='settingtype']:checked").val();
		if(perissionStr == "所有人"){
			index = 1;
		} else if(perissionStr == "仅圈主"){
			index = 3;
		} else {
			index = 2;
		}
		$modal.modal();
		$.ajax({
			type: "POST",														  
			url: urlPath,
			data: {
				token : localStorage.getItem("token"),   
				permissions: index
			},
			dataType: "json",
			success: function(data) {
				$modal.modal('close');
				console.log(data);
				var code = data.code;
				console.log(code);
				if(code == "1") {
					location.href = "set_permission.html";								  
				} else {
					alert(data.message + "");									  
				}
				
			},
			error: function(e){		//错误之后的动作
				$modal.modal('close');
				alert("服务请求异常！");
			}
		});
	});
		

});